package com.yanfan.maintain.service;


import com.yanfan.attach.domain.DeviceDetail;
import com.yanfan.common.core.domain.AjaxResult;
import com.yanfan.energy.domain.*;
import com.yanfan.energy.domain.model.ComboBoxBody;
import com.yanfan.energy.domain.MaintainTasksItems;
import com.yanfan.iot.domain.DeviceLifecyle;
import com.yanfan.maintain.domain.InspectionTask;
import com.yanfan.maintain.domain.ReleaseTask;

import java.util.List;
import java.util.Map;

/**
 * 设备保养计划表(MaintenancePlan)表服务接口
 *
 * @author makejava
 * @since 2023-03-09 15:02:16
 */
public interface MaintenancePlanService {

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    MaintenancePlan queryById(Long id);

    /**
     * 分页查询
     *
     * @param maintenancePlan 筛选条件
     * @return 查询结果
     */
    List<MaintenancePlan> queryByPage(MaintenancePlan maintenancePlan);

    /**
     * 新增数据
     *
     * @param maintenancePlan 实例对象
     * @return 实例对象
     */
    MaintenancePlan insert(MaintenancePlan maintenancePlan);

    /**
     * 修改数据
     *
     * @param maintenancePlan 实例对象
     * @return 实例对象
     */
    MaintenancePlan update(MaintenancePlan maintenancePlan);

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    boolean deleteById(Long id);

    List<BaseOrderEntity> comboBoxLinkage(BaseDictEntity baseDictEntity);


    List<MaintainTasks> taskList(MaintainTasks tasks);

    List<MaintainTasks> taskListByPlan(MaintenancePlan maintenancePlan);

    /**
     * 设备保养顶部接口
     * 保养任务分布、保养情况、保养频率
     *
     * @param maintainTopRequest
     * @return
     */
    Map maintainTop(MaintainTopRequest maintainTopRequest);

    List<MaintainTasks> queryTaskByPage(MaintainTasks maintainTasks);

    MaintainTasks queryTaskById(Long id);

    int deleteTaskById(Long id);

    int deleteTaskByIds(Long[] ids);

    MaintainTasks taskAdd(MaintainTasks maintainTasks);

    MaintainTasks taskEdit(MaintainTasks maintainTasks);

    Map<String, List<MaintainTasks>> showPlansByMonth(String yearMonth);

    List<BaseOrderEntity> planPeriodList();

    List<BaseOrderEntity> planTypeList();

    Map operationCase();

    Map operationCaseNew(DeviceChartRequest request);

    Map deviceDevOps(DeviceChartRequest request);


    List<DevOpsTask> devOpsTask(DevOpsTask request);

    /**
     * 设备运维任务 分析
     *
     * @param request
     * @return
     */
    DevOpsAnalyse devOpsAnalyse(DeviceChartRequest request);

    List<DevOpsTask> devOpsTaskRecord(DevOpsTask request);

    /**
     * 任务完成
     *
     * @param request
     */
    void devOpsTaskFinish(DevOpsTask request);

    void devOpsTaskStart(DevOpsTask request);

    /**
     * 处理意见
     *
     * @param request
     */
    void devOpsTaskHandling(DevOpsTask request);

    void releaseTask(ReleaseTask request);

    /**
     * 任务详情查看
     *
     * @param request
     * @return
     */
    ReleaseTask devOpsTaskDetails(ReleaseTask request);

    ReleaseTask devOpsTaskModify(ReleaseTask request);

    Map<String, Integer> selectDeviceStatistic(DeviceChartRequest request);


    String generateTaskNo(Integer taskType);

    /**
     * 新设备列表
     *
     * @param device
     * @return java.util.List<com.ruoyi.iot.domain.Device>
     * @author caijinkang
     * @date 2023/4/3 14:45
     */
    public List<DeviceDetail> newListByDevice(DeviceDetail device);

    /**
     * 查询设备分组下拉框信息
     *
     * @return com.ruoyi.common.core.domain.AjaxResult
     * @author caijinkang
     * @date 2023/4/4 10:44
     */
    public List<ComboBoxBody> findGroupComboBox();

    public List<ComboBoxBody> findProductComboBox();

    /**
     * 查询新设备详情
     *
     * @param deviceId
     * @return com.ruoyi.iot.domain.Device
     * @author caijinkang
     * @date 2023/4/3 16:42
     */
    public Map<String, Object> selectNewDeviceByDeviceId(Long deviceId);

    List<MaintainTasksItems> taskItemsList(MaintainTasksItems tasks);

    MaintainTasksItems selectMaintainTasksItemsById(Long id);

    int insertMaintainTasksItems(MaintainTasksItems maintainTasksItems);

    int updateMaintainTasksItems(MaintainTasksItems maintainTasksItems);

    int deleteMaintainTasksItemsByIds(Long[] ids);

    List<ImageUrl> selectMaintainImgs(MaintainTasks tasks);

    int updateMaintainImgs(MaintainTasks tasks);

    List<ImageUrl> selectInspectionImgs(InspectionTask tasks);

    int updateInspectionImgs(InspectionTask tasks);

    /**
     * 生命周期的逻辑判断
     */
    void updatelifeCycle(Long DeviceId);

    /**
     * 操作日志
     */
    void addMaintainLog(MaintainLog maintainLog);

    /**
     * 设备基本信息修改响应
     */
    AjaxResult devcioeUpdatelifeCycle(DeviceDetail deviceDetail);

    /**
     * 查询日志信息
     */
    List<MaintainLog> selectMaintainLogList(Long deviceId);

    void updateDeviceLifecyle(Long deviceId, int lifeCycleStatus);

    void addMaintainLogs(String name, Long deviceId);

    List<DeviceLifecyle> getDeviceLifecyle(Long deviceId);
}
